This invention is related to image processing and pattern recognition and more particularly to improving template matching to be largely independent of size and rotation variation.
1. Background of the Invention
Pattern matching is a simple yet powerful machine vision tool. The normalized correlation method has been widely used in many machine vision applications. The match score of normalized correlation is largely independent of linear variations in object shading caused by reflectivity or illumination variations. However, the normalized correlation method does not work well when the pattern being searched is subject to rotation or size variations. The match score could drop significantly when only a few degrees of rotation or a small percentage of size change occurs.
2. Prior Art
Pattern matching is a simple yet powerful machine vision tool. A type of pattern matching, normalized correlation, (Ballard D H and Brown C M, xe2x80x9cComputer Visionxe2x80x9d, Prentice-Hall Inc. 1982 pp. 68-70) has been widely used in many machine vision applications. The match score from normalized correlation is largely independent of linear variations in object shading caused by reflectivity or illumination variations. However, the normalized correlation method does not work well when the pattern being searched is subject to rotation or size variations. The match score could drop significantly even for only a few degrees of rotation or a few percent size difference from the template.
One prior approach to resolving this sensitivity is to rotate and scale the pattern template, making multiple templates and then try all possible scale and rotation combinations. However, this is very computationally expensive and has not been widely used. Another prior art approach is to use a geometric pattern matching method such as PatMax introduced by Cognex (Silver, B, xe2x80x9cGeometric Pattern Matching for General-Purpose Inspection in Industrial Machine Visionxe2x80x9d, Intelligent Vision ""99 Conferencexe2x80x94Jun. 28-29, 1999). This approach uses geometric information in place of pixel grid-based normalized correlation. For example, it interprets a square as four line segments and a football as two arcs. It extracts key geometric features within an object image using a method such as boundary encoding and from the extracted features measures characteristics such as shape, dimensions, angle, arcs, and shading. It then adjusts the spatial relationships in the pattern template (by scaling and rotation) to match the key features of the new input image. However, this prior art approach requires high edge contrast and low noise between patterns and background to reliably extract the key geometric features for matching. This prior art approach fails when edges of the key features are noisy or indefinite. This is the inherent problem when using a geometric approach in place of a pixel grid based approach.
It is an object of the invention to provide a fast pattern search method that can accurately locate patterns of interest in instances where they vary in size or orientation, when their appearance is degraded, and even when they are partially hidden from view.
It is an object of the invention to achieve the advantages of rotation and scale invariance while using the pixel grid based approach on low contrast and noisy images.
It is an object of the invention to use a multi-resolution coarse-to-fine search approach for fast template searching.
It is an object of the invention to perform fast correlation using a weighted histogram sum to compute the correlation score. When the number of gray scale values is limited, this can decrease the computation time required. This technique is particularly applicable for large pattern templates.
It is an object of the invention to implement the fast search method in a general purpose computer platform without any special hardware. This reduces cost and system complexity.
This invention generates a polar coordinate representation of the pattern template image or a feature enhanced template image that allows for fast search of scale along the radial axis and rotation along the angular axis. Fast search can be achieved by projecting image intensities into the radial axis and transforming them to create multiple scale templates for scale search and projecting image intensities into angular axis for rotation angle search by one dimensional pattern matching. Furthermore, a multi-resolution coarse to fine search approach can be used to further increase the search speed. In this approach, wide search ranges are applied only using the lower resolution images or profiles and a fine-tuning search is applied using higher resolution images or profiles. This efficiently achieves wide search range and fine search resolution.